package whu.edu.demo.dao;

import whu.edu.demo.domain.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import whu.edu.demo.domain.ProductDTO;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface ProductDao  extends BaseMapper<Product> {
    @Select("SELECT * FROM product WHERE product.Id = #{id}")
    @Results({@Result(id = true,property = "Id",column = "Id"),
            @Result(property = "name",column = "name"),
            @Result(property = "price",column = "price"),
            @Result(property = "suppliers",column = "Id",
                    many = @Many(select = "whu.edu.dao.SupplierDao.findSupplierByProductId"))})
    List<ProductDao> findSupplier(int id);
}

